package u.can.i.up.db.mysql.category;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class InitialUtils {

	static Logger logger = LogManager.getLogger();

	@SuppressWarnings("rawtypes")
	public static Map<String, String> initial(Map<String, String> packageCategoryMap) {
		Map<String, String> categoryMap = new HashMap<String, String>();
		Iterator iter = packageCategoryMap.entrySet().iterator();
		while (iter.hasNext()) {
			Map.Entry entry = (Map.Entry) iter.next();
			String key = (String) entry.getKey();
			String value = (String) entry.getValue();
			String tmpCategory = jduge(value);
			if (tmpCategory != null) {
				categoryMap.put(key, tmpCategory);
			} else {
				categoryMap.put(key, "");
				logger.info("\t" + value);
			}
		}
		return categoryMap;
	}

	private static String jduge(String str) {
		String returnStrings = null;
		switch (str) {

		// TODO "支付"
		case "理财购物":
		case "购物消费":
		case "生活 购物":
		case "网络购物":
		case "网购":
		case "生活.购物":
		case "金融证券":
		case "购物":
		case "网购支付":
		case "生活购物":
		case "财务":
		case "数码家电-小家电":
		case "金融":
		case "购物理财":
		case "购物软件":
		case "网上购物":
		case "办公理财":
		case "购物支付":
		case "理财,网购":
		case "金融理财":
		case "理财软件":
		case "办公.商务":
		case "支付":
		case "证券":
		case "银行":
		case "生活购物旅行":
		case "TRANSPORTATION":
		case "TRAVEL_AND_LOCAL":
		case "购物优惠":
		case "理财":
		case "Shopping":
		case "SHOPPING":
		case "WEATHER":
		case "Business":
		case "Finance":
		case "FINANCE":
		case "Productivity":
			returnStrings = "支付";
			break;

		// TODO "社交"
		case "通讯":
		case "软件 / 安卓社交通讯":
		case "通信":
		case "社交软件":
		case "SOCIAL":
		case "Communication":
		case "COMMUNICATION":
		case "社交":
		case "社交微博":
		case "社交聊天":
		case "网络.社区":
		case "即时聊天":
		case "通讯.聊天":
		case "网络社交":
		case "社区交友":
		case "社区和交友":
		case "主题 社区交友":
		case "聊天通讯":
		case "聊天社交":
		case "通信聊天":
		case "社交网络":
		case "聊天.通讯":
		case "社交通讯":
		case "网络社区":
		case "聊天社区":
		case "聊天":
		case "网络通信":
		case "聊天工具":
		case "通讯社交":
		case "聊天交友":
		case "通讯聊天":
		case "Social":
			returnStrings = "社交";
			break;

		// TODO "生活"
		case "便捷生活":
		case "出行必备":
		case "健康运动":
		case "健康":
		case "旅游出行":
		case "医疗健康":
		case "图书阅读":
		case "HEALTH_AND_FITNESS":
		case "书籍杂志":
		case "LIFESTYLE":
		case "LIBRARIES_AND_DEMO":
		case "MEDIA_AND_VIDEO":
		case "MEDICAL":
		case "美食":
		case "网络邮件":
		case "生活休闲":
		case "学习办公":
		case "行业门户":
		case "运动健康":
		case "生活实用":
		case "医疗保健":
		case "旅游":
		case "生活.地图":
		case "生活":
		case "日常生活":
		case "交通导航":
		case "地图出行":
		case "天气":
		case "个性化":
		case "医药":
		case "保健与健身":
		case "Weather":
		case "旅游与本地出行":
		case "Health & Fitness":
		case "Travel & Local":
		case "Arcade":
		case "交通":
		case "NEWS_AND_MAGAZINES":
		case "PERSONALIZATION":
		case "Transport":
		case "财经":
		case "新闻":
		case "资讯新闻":
		case "阅读学习":
		case "儿童亲子":
		case "旅行.地图":
		case "生活助手":
		case "阅读":
		case "新闻阅读":
		case "教育阅读":
		case "地图导航":
		case "综合服务":
		case "便捷生活,新闻资讯,日历,新闻":
		case "新闻资讯":
		case "健康医疗":
		case "气象交通":
		case "网络.邮件":
		case "资讯和阅读":
		case "健身":
		case "资讯.词典":
		case "教育教学":
		case "天气时间":
		case "导航":
		case "生活方式":
		case "Personalisation":
		case "Lifestyle":
		case "Libraries & Demo":
		case "Books & Reference":
		case "Trivia":
			returnStrings = "生活";
			break;

		// TODO "教育"
		case "Education":
		case "Educational":
		case "教育学习":
		case "BOOKS_AND_REFERENCE":
		case "EDUCATION":
		case "教育":
		case "阅读.学习":
			returnStrings = "教育";
			break;

		// TODO "办公"
		case "软件与演示":
		case "图书与工具书":
		case "商务":
		case "办公词典":
		case "公司":
		case "商务办公":
		case "办公商务":
		case "办公":
		case "BUSINESS":
		case "Word":
		case "效率办公":
		case "Board":
			returnStrings = "办公";
			break;

		// TODO "娱乐"
		case "动漫":
		case "音视频多媒体":
		case "COMICS":
		case "MUSIC_AND_AUDIO":
		case "图书动漫":
		case "卡通动漫":
		case "音乐视频":
		case "视频播放":
		case "都市小说":
		case "影视播放":
		case "休闲趣味":
		case "音乐音频":
		case "创意休闲":
		case "影音播放":
		case "新闻杂志":
		case "电子书籍":
		case "生活时尚":
		case "摄影":
		case "媒体与视频":
		case "音乐与音频":
		case "体育":
		case "报刊杂志":
		case "娱乐":
		case "娱乐八卦":
		case "网络视频":
		case "生活娱乐":
		case "电子图书":
		case "娱乐摄影":
		case "休闲娱乐":
		case "影音.图像":
		case "书籍阅读":
		case "影视明星":
		case "Sports":
		case "Music":
		case "Comics":
		case "影音图像":
		case "比赛":
		case "爱情星座":
		case "音乐和视频":
		case "影音工具":
		case "精彩娱乐内容":
		case "玄幻小说":
		case "小说和漫画":
		case "Simulation":
		case "主题 影视明星":
		case "Casual":
		case "Puzzle":
		case "News & Magazines":
		case "Media & Video":
		case "Music & Audio":
		case "Casino":
		case "Entertainment":
		case "ENTERTAINMENT":
			returnStrings = "娱乐";
			break;

		// TODO "游戏"
		case "游戏":
		case "体育游戏游戏":
		case "飞行游戏":
		case "休闲时间,益智":
		case "动作射击,飞行":
		case "对战格斗":
		case "动作":
		case "跑酷竞速":
		case "主题 卡通游戏":
		case "游戏类别：飞行射击":
		case "棋牌":
		case "游戏类别：网络游戏":
		case "赛车":
		case "游戏 休闲益智":
		case "游戏 / 手机动作冒险":
		case "扑克棋牌,麻将":
		case "体育音乐游戏":
		case "塔防守卫,经营策略,闯关,战争":
		case "儿童益智,休闲时间,智力开发,益智":
		case "动作格斗":
		case "射击空战":
		case "模拟经营游戏":
		case "棋牌益智":
		case "其他游戏":
		case "射击动作":
		case "策略棋牌":
		case "体育射击":
		case "卡牌手游":
		case "模拟辅助":
		case "扑克棋牌":
		case "卡牌游戏":
		case "休闲":
		case "回合":
		case "射击游戏":
		case "卡片棋牌":
		case "经营养成":
		case "棋牌桌游游戏":
		case "益智游戏":
		case "体育赛车":
		case "游戏 / 手机益智休闲":
		case "益智休闲游戏":
		case "飞行":
		case "经营策略":
		case "动作射击":
		case "赛车竞速游戏":
		case "策略经营":
		case "赛车游戏游戏":
		case "体育竞技":
		case "模拟经营":
		case "虚拟养成":
		case "网游":
		case "益智休闲":
		case "策略塔防游戏":
		case "益智":
		case "射击冒险":
		case "射击":
		case "动作跑酷":
		case "棋牌天地":
		case "动作竞技":
		case "SPORTS":
		case "角色冒险":
		case "格斗":
		case "动作游戏":
		case "飞行射击":
		case "卡通游戏":
		case "策略塔防":
		case "策略游戏游戏":
		case "动作探险游戏":
		case "体育竞速":
		case "赛车竞速":
		case "游戏类别：角色扮演":
		case "棋牌游戏":
		case "休闲益智":
		case "消除游戏":
		case "休闲游戏游戏":
		case "全部游戏":
		case "动作冒险":
		case "冒险":
		case "角色扮演":
		case "格斗对战":
		case "竞速游戏":
		case "策略游戏":
		case "战略":
		case "手机网游":
		case "疯狂跑酷":
		case "冒险闯关":
		case "射击飞行游戏":
		case "赛车游戏":
		case "休闲游戏":
		case "体育游戏":
		case "网络游戏":
		case "棋牌桌游":
		case "射击飞行":
		case "养成游戏":
		case "街机模拟":
		case "纸牌游戏":
		case "益智类游戏":
		case "益智和解谜游戏":
		case "Adventure":
		case "GAME_ACTION":
		case "GAME_ADVENTURE":
		case "GAME_ARCADE":
		case "GAME_BOARD":
		case "GAME_CARD":
		case "GAME_CASINO":
		case "GAME_CASUAL":
		case "GAME_EDUCATIONAL":
		case "GAME_FAMILY":
		case "GAME_MUSIC":
		case "GAME_PUZZLE":
		case "GAME_RACING":
		case "Racing":
		case "GAME_ROLE_PLAYING":
		case "GAME_SIMULATION":
		case "GAME_SPORTS":
		case "GAME_STRATEGY":
		case "GAME_TRIVIA":
		case "GAME_WORD":
		case "Action":
		case "Card":
		case "Strategy":
		case "Role Playing":
		case "街机和动作游戏":
			returnStrings = "游戏";
			break;

		// TODO "工具"
		case "工具":
		case "系统.输入":
		case "TOOLS":
		case "常用工具,密码":
		case "安全软件":
		case "安全":
		case "系统":
		case "辅助工具":
		case "网络浏览":
		case "通话通信":
		case "系统和工具":
		case "工具软件":
		case "拍照美化":
		case "浏览器":
		case "电话":
		case "系统安全":
		case "实用工具":
		case "系统输入":
		case "系统工具":
		case "常用工具":
		case "Tools":
		case "效率":
		case "同步备份":
		case "安全相关":
		case "软件 安全防护":
		case "PRODUCTIVITY":
		case "安全防护":
			returnStrings = "工具";
			break;

		// TODO "主题"
		case "主题桌面":
		case "创意色彩":
		case "桌面壁纸":
		case "壁纸主题":
		case "主题 艺术插画":
		case "摄影美化":
		case "主题":
		case "艺术插画":
		case "主题 动物植物":
		case "动态壁纸":
		case "主题壁纸":
		case "摄影摄像":
		case "美化壁纸":
		case "壁纸":
		case "壁纸.主题":
		case "PHOTOGRAPHY":
		case "桌面组件":
		case "壁纸美化":
		case "美化":
		case "手机美化":
		case "桌面美化":
		case "桌面":
		case "拍摄美化":
		case "壁纸主题铃声":
			returnStrings = "主题";
			break;

		default:
			break;
		}
		return returnStrings;
	}

}
